package com.sina.shop.eureka.consume.controller.log;

import com.sina.shop.domain.log.Log;
import com.sina.shop.eureka.consume.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:  处理外部请求controller
 * 段浩杰   2018-01-31-17:51
 */
@RestController
@RequestMapping("/shop-web/log")//shop-web此映射路径为了匹配路由
public class LogController {

    @Autowired
    @Qualifier("logService")
    private LogService logService;


    @RequestMapping(value = "/getLog", method = RequestMethod.GET)
    public Log getLog(Long id) {
        return logService.getLog(id);
    }

    @RequestMapping(value = "/getLogList", method = RequestMethod.GET)
    public List<Log> getLogList(Log log) {
        return logService.getLogList(log);
    }

    @RequestMapping(value = "/saveLog", method = RequestMethod.POST)
    public Log saveLog(Log log) {
        return logService.saveLog(log);
    }

    @RequestMapping(value = "/deleteLog", method = RequestMethod.POST)
    public Integer deleteLog(Long id) {
        return logService.deleteLog(id);
    }
}
